package com.sunday.aomi.ui.order;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.flyco.tablayout.SlidingTabLayout;
import com.sunday.common.adapter.MainFragmentPagerAdapter;
import com.sunday.common.base.BaseActivity;
import com.sunday.aomi.R;
import com.sunday.member.constv.ConstValue;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by 刘涛 on 2017/5/26.
 */

public class BuyOrderListActivity extends BaseActivity {


    @Bind(R.id.title)
    TextView title;
    @Bind(R.id.slide_tab)
    SlidingTabLayout slideTab;
    @Bind(R.id.view_pager)
    ViewPager viewPager;

    private ArrayList<Fragment> fragments = new ArrayList<>();
    private final String[] mTitles = {
            "待发货", "待收货", "全部"
    };
    private int pageNo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_buy_order_list);
        ButterKnife.bind(this);
        pageNo=getIntent().getIntExtra("page",0);
        initView();
    }

    private void initView() {
        title.setText("进货订单");
        fragments.add(BuyOrderListFragment.newInstance(ConstValue.ORDER_TYPE_THREE, ConstValue.STA_TWO));
        fragments.add(BuyOrderListFragment.newInstance(ConstValue.ORDER_TYPE_THREE, ConstValue.STA_THREE));
        fragments.add(BuyOrderListFragment.newInstance(ConstValue.ORDER_TYPE_THREE, ConstValue.STA_ZERO));
        viewPager.setAdapter(new MainFragmentPagerAdapter(getSupportFragmentManager(), mContext, fragments,
                R.array.buy_order_list_title));
        slideTab.setViewPager(viewPager, mTitles, this, fragments);
        viewPager.setCurrentItem(pageNo,false);
    }
}
